The Challenge: Why Medical AI?
Early and precise detection of brain tumours is paramount for patient survival and comprehensive treatment
planning. Traditionally, detecting complex anomalies in MRI scans is a highly manual, time-consuming process
heavily reliant on the subjective expertise of radiologists.
The core challenge was to build a system that not only classifies tumours with blistering accuracy but also
dismantles the "black box" nature of typical neural networks, providing physicians with visual proof of
why the model made its diagnosis.
Architecture & Transfer Learning
To bypass the massive computational overhead of training a CNN entirely from scratch—and to leverage powerful
pre-learned feature extraction—I implemented Transfer Learning utilizing the robust
VGG16 architecture originally trained on ImageNet.
Data Preprocessing Pipeline
Using OpenCV, the MRI dataset was aggressively augmented and normalized. Extreme care was
taken with the data to prevent data leakage and bias:
- Image Cropping: Utilizing contour detection to remove vast dark edge spaces from the MRI.
This ensures the CNN exclusively learns computational brain tissue features, rather than border artifacts.
- Data Augmentation: Applying randomized rotations, minor zooms, and horizontal flips. This
prevents severe overfitting and drastically improves the model's generalization capabilities on unseen
clinical patient scans.
Technical Insight
By aggressively freezing the early convolutional blocks of VGG16 (which detect basic edges and geometric
shapes) and exclusively fine-tuning the deeply nested dense layers specifically on the new MRI dataset, the
model reached staggering validation benchmarks rapidly without collapsing gradients.
Grad-CAM: Building Trust with Physicians
A major hurdle in Medical AI adoption is the distinct lack of interoperability. If an AI predicts a malignant
tumour, doctors fundamentally must verify the claim. To solve this critical bottleneck, I integrated
Gradient-weighted Class Activation Mapping (Grad-CAM).
Grad-CAM generates coarse localization heatmaps detailing which exact regions of the MRI heavily influenced
the classifier's output. By dynamically overlaying the heatmap directly onto the original MRI slice, the
system mathematically highlights the tumour boundaries—working as an intelligent 'second-set of eyes' for
radiologists rather than acting as a replacement.
Results & Technologies Used
The network completed its training cycle achieving an exceptional 97.75% peak classification
accuracy, proving highly robust against false negatives on independent, segregated testing sets.
The addition of the Grad-CAM module brought the precision in line with clinical trust requirements.
The Technology Stack
Python
TF TensorFlow
K Keras
VGG16
CV OpenCV
Matplotlib
Grad-CAM