
Brain Tumor Classification Using CNNs (Image Classification)
January 15, 2025
Description: Developed a CNN (Image Classification) model using a public MRI dataset from Kaggle that classifies brain MRI images into one of four categories: no tumor, pituitary tumor, glioma tumor, and meningioma tumor.
Achieved a 94.00% Test accuracy, 95.03% Test Precision, 94.00% Recall and 93.95% F1 score in 21 epochs.
Code, Notebook and Results:
I've included detailed commentary explaining each step and how to interpret the code and results. Even if you're new to Python or machine learning, I break down each section clearly—from convolution layers to dense layers to F1 scores. Feel free to explore the final product!
PDF Version (published w/ Latex formatting):
Brain MRI Classification; Glioma, Meningioma, No Tumor, Pituitary; Sohi, 2025.pdf
Jupyter Notebook Version:
Brain MRI Classification; Glioma, Meningioma, No Tumor, Pituitary; Sohi, 2025.ipynb
Motivation & Overview
After working on machine learning for the "Examining Complex Impacts of E-shopping and Built Environment Factors on Shopping VMT" project, I wanted to further develop these skills, particularly in image classification. While I had completed a basic image classification project two years ago, I wanted to apply the advanced skills I gained during last year's research paper—especially in hyperparameter tuning and model building. I chose this medical project because many of my cousins and family members work in medicine, which inspired me to explore healthcare applications. Though I switched from pre-med to computer science when starting university, I maintain a deep interest in biology and medicine. There's something fascinating about studying the internal workings of the human body rather than external phenomena.
I developed a Convolutional Neural Network (CNN) model to classify brain MRI images into four categories: **no tumor, pituitary tumor, glioma tumor, and meningioma tumor**. Using a public dataset from Kaggle, the model achieved a 94% test accuracy and a 0.9395 F1 score in 21 epochs, demonstrating robust performance in medical image classification. I used the Kraggle Public Dataset: Brain Tumor MRI Dataset by Masoud Nickparvar.
Key Findings
Final Test accuracy: 94.00%. Precision: 94.03%. Recall: 94.00%, F1 Score: 93.95%
Meningioma tumors had the lowest F1 score (0.91) among all categories, with 11 cases misclassified as glioma and 8 cases misclassified as "no tumor,”
"No tumor" and pituitary tumor categories performed best, each achieving an F1 score of 0.96 = 96%.
Pituitary tumors had the highest recall at 99%, showing excellent detection rate.
The model achieved strong overall performance but shows room for improvement in distinguishing between meningioma and other categories.
Skills Applied:
Machine Learning and Artificial Intelligence (AI)
Convolutional Neural Networks (CNNs)
Medical Image Processing
Data Analysis and Model Evaluation
End Result: This project exemplifies the intersection of AI and healthcare, showcasing how machine learning can contribute to practical, impactful solutions in medical diagnostics.