Brain Tumor Classification: CNN Model for MRI Image Analysis

January 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:

'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.

Motivation & Overview

I was pre-med before switching over to computer science and economics in uni, and I still have an interest in biology. I wanted to combine my machine learning background with this interest, so using a public dataset from Kaggle “Brain Tumor MRI Dataset” by Masoud Nickparvar, I created a Convolutional Neural Network (CNN) that classifies MRI scans into four categories: no tumor, pituitary tumor, glioma tumor, or meningioma tumor. This project was both fun and challenging, right in the goldilocks zone!

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 Convolutional Neural Networks (CNNs) – Designed and implemented a deep learning model for medical image classification, utilizing CNNs with convolutional layers, max pooling, and dense layers to extract features and classify brain tumors with high accuracy.

  • Image Processing – Preprocessed MRI images through resizing, normalization, and augmentation to improve model generalization and robustness across different tumor types.

  • Data Analysis and Model Evaluation – Assessed model performance using accuracy, precision, recall, F1-score, and confusion matrices, identifying misclassification trends. Proposed improvements to enhance accuracy and reduce bias.

End Result: This project exemplifies the intersection of AI and healthcare, showcasing how machine learning can contribute to practical, impactful solutions in medical diagnostics.

Previous
Previous

Detecting Sarcasm with AI: Building an LSTM Model for News Headlines

Next
Next

Examining Impacts of E-shopping and Built Environment Factors on Shopping VMT