Skip to content

Samyrrrrrr990/Science-Fair

Repository files navigation

Brain Tumor Detection and Classification Using Deep Learning

Overview

This project presents a deep learning–based system for automated brain tumor detection and classification from 2D brain MRI images. The model determines whether a tumor is present and, if so, identifies the tumor type. The work emphasizes methodological rigor, proper dataset handling, and reliable evaluation suitable for research and academic review.


Classification Targets

The model performs multi-class classification with the following categories:

  • Glioma
  • Meningioma
  • Pituitary tumor
  • No tumor

Dataset

This project uses a publicly available 2D brain MRI dataset sourced from Kaggle.
All images are pre-extracted 2D slices, eliminating the need for volumetric processing or slice generation.

Dataset Characteristics

  • Imaging modality: Brain MRI (2D)
  • Image format: JPEG/PNG
  • Balanced class distribution across four categories
  • Labeled and pre-processed for supervised learning

The dataset is commonly used in academic benchmarking and provides a reliable foundation for evaluating multi-class brain tumor classification models.


Data Handling and Preprocessing

  • Images are resized and normalized to ensure consistency across samples
  • Data is split into training, validation, and test sets
  • Class balance is preserved across splits
  • No data augmentation techniques that could introduce label leakage are applied during testing

Model Architecture

Two modeling strategies are implemented:

1. Convolutional Neural Network Trained From Scratch

A custom CNN designed specifically for brain MRI classification.
This approach learns features directly from the dataset without pretrained priors.

2. Transfer Learning with ResNet-18

A pretrained ResNet-18 architecture fine-tuned on the MRI dataset.
Transfer learning significantly improves convergence speed and final classification performance.


Training Configuration

  • Framework: PyTorch
  • Device: CPU
  • Loss Function: Cross-Entropy Loss
  • Optimizer: Adaptive gradient-based optimizer
  • Early stopping based on validation accuracy

Evaluation Metrics

Performance is evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-score
  • Confusion matrix analysis

All metrics are reported on a strictly held-out test set.


Results

From-Scratch Model

  • Test accuracy consistently between 94% and 98%
  • Strong class-wise performance across all tumor types

Pretrained ResNet-18 Model

  • Final test accuracy: 98.98%
  • Near-perfect precision and recall across all classes
  • Minimal inter-class confusion observed

Reproducibility

  • Deterministic training with fixed random seeds
  • Clear separation of training, validation, and test data
  • Model weights excluded from version control
  • Fully reproducible training and evaluation scripts

Ethical and Research Considerations

This project is intended solely for research and educational purposes.
It is not a clinical diagnostic system and must not be used in medical decision-making.


Future Work

  • Evaluation on multi-institutional datasets
  • Extension to 3D volumetric MRI classification
  • Tumor segmentation and localization
  • Model explainability and interpretability analysis

Disclaimer

All results are experimental and reflect performance on a specific public dataset.
Clinical applicability requires extensive validation and regulatory approval.

About

A deep learning model for classifying brain tumors from 2D MRI images, identifying glioma, meningioma, pituitary tumors, and non-tumor cases using both custom CNNs and transfer learning.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages