Skip to content

MDenizCan/BrainTumorDetectionSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Brain Tumor Detection System

An automated medical imaging system designed to detect and classify brain tumors from MRI scans using Convolutional Neural Networks (CNN).

📋 Project Overview

This project processes MRI images to classify them into one of 4 categories:

  1. Glioma
  2. Meningioma
  3. Pituitary
  4. No Tumor

We utilize a CNN architecture for feature extraction and classification, achieving high accuracy through K-Fold Cross Validation.


🛠️ Setup & Installation

1. Prerequisites

Ensure you have Python 3.8+ installed.

2. Install Dependencies

Run the following command to install all required libraries:

pip install -r requirements.txt

Key Libraries used: tensorflow, pandas, numpy, matplotlib, seaborn, scikit-learn

3. Dataset Setup

Note: The dataset is not included in this repository.

  1. Place your dataset folder in the project root.
  2. Ensure it has the standard structure:
    dataset/Training/glioma/
    dataset/Training/meningioma/
    dataset/Training/notumor/
    dataset/Training/pituitary/
    dataset/Testing/glioma/
    dataset/Testing/meningioma/
    dataset/Testing/notumor/
    dataset/Testing/pituitary/
    
  3. Update the DATASET_PATH variable in train_model.py if your folder name is different.

🚀 How to Run

Step 1: Analyze the Data

Check the balance of the dataset to ensure fair training.

python data_analysis.py

Outputs: dataset_distribution.png (Bar chart of image counts)

Step 2: Train the Model

Train the CNN using 5-Fold Cross Validation. This will generate training graphs and save the best model.

python train_model.py

Outputs:

  • tumor_detection_model.h5 ( The saved trained model)
  • accuracy_fold_X.png & loss_fold_X.png (Training graphs)
  • confusion_matrix_fold_X.png (Performance heatmaps)

Step 3: Interactive Evaluation

Test the model yourself! This script opens a window where you can click "Next" to see predictions on random test images.

python interactive_eval.py

(Requires tumor_detection_model.h5 to exist)


📊 Technical Details

  • Model: Custom Sequential CNN (3 Convolutional Blocks + Dropout).
  • Input: 150x150 pixel MRI images.
  • Validation: 5-Fold Cross Validation to ensure robustness.
  • Metrics: We monitor Accuracy, Loss (Sparse Categorical Crossentropy), and Confusion Matrices.

About

An automated medical imaging system designed to detect and classify brain tumors from MRI scans using Convolutional Neural Networks (CNN).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages