Skip to content
All projects

Brain Tumor MRI Classification

Four-class brain tumor classification from MRI using MobileNetV2 transfer learning, with Grad-CAM used to check that the model attends to tumor regions rather than scan artifacts.

  • PyTorch
  • MobileNetV2
  • Grad-CAM
  • scikit-learn
  • NumPy
Cover image for Brain Tumor MRI Classification

A four-class classifier over brain MRI scans (glioma, meningioma, pituitary tumor, and no tumor) built on MobileNetV2 transfer learning.

Results

MetricValue
Test accuracy76%
Macro F10.75

Macro F1 is reported alongside accuracy deliberately: the classes are not evenly represented, and accuracy alone would flatter the model on the majority classes while hiding weaker recall on the harder ones.

Approach

MobileNetV2 pretrained on ImageNet was used as the backbone, with the classifier head replaced and the network fine-tuned on the MRI dataset. The lightweight backbone was chosen on purpose because the accuracy cost relative to a heavier network was small, and the smaller model trains and runs fast enough to iterate on within a single GPU session.

Augmentation was kept conservative (flips, small rotations, intensity jitter). Aggressive geometric augmentation is tempting for a small medical dataset but risks producing scans that are anatomically implausible, which teaches the model the wrong invariances.

Interpretability

Accuracy on a held-out split does not tell you why a medical classifier is right. Grad-CAM was used on correct and incorrect predictions alike to visualise which regions drove each decision. The check that mattered was whether activations concentrated on tumor regions or on scan-level artifacts (skull outline, acquisition banding, and padding) that correlate with class in the dataset but would not generalise to a new scanner. Reviewing the failure cases this way was more informative about the model's real limits than the headline metric.