Skip to content

A deep learning project using PyTorch to classify brain tumors from MRI images into categories like No Tumor, Pituitary, Glioma, and Meningioma.

License

Notifications You must be signed in to change notification settings

HalemoGPA/BrainMRI-Tumor-Classifier-Pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain Tumor Classification

License: MIT GitHub issues GitHub pull requests visitors

This repository contains a deep learning-based solution for classifying brain tumors using MRI images. The model is trained to classify images into four categories: No Tumor, Pituitary, Glioma, Meningioma

Table of Contents

Overview

This project uses a Convolutional Neural Network (CNN) implemented in PyTorch to classify brain MRI images. The model architecture consists of multiple convolutional, batch normalization, max-pooling layers followed by fully connected layers.

Dataset

The dataset used is the Brain Tumor MRI Dataset available on Kaggle. It contains MRI images for training and testing the model.

Requirements

  • Python 3.x
  • PyTorch
  • Torchvision
  • NumPy
  • Scikit-learn
  • Matplotlib
  • Seaborn
  • Streamlit

Training

The training script preprocesses the images, defines the model architecture, and trains the model.

  1. Preprocessing: Images are resized and normalized.
  2. Model Architecture: Defined in model.py.
  3. Training Loop: Defined in the notebook with performance metrics.

Evaluation

The trained model is evaluated on a validation set, and the best-performing model is saved. The evaluation metrics include accuracy and loss.

Streamlit App

A Streamlit application has been developed to facilitate the deployment of the model and enable predictions on new MRI images. The app can be accessed here.

Functionality:

  1. Model Loading: The pre-trained model is loaded automatically upon accessing the app.
  2. Image Upload: Users can upload MRI images directly to the app interface.
  3. Prediction Display: Once an image is uploaded, the app displays the predicted tumor type based on the model's classification.

The Streamlit app provides a user-friendly interface for interacting with the model and obtaining predictions effortlessly.

Run the Streamlit app:

streamlit run app.py

Project Demo

Project.Demo.mp4

Usage

  1. Clone the repository:
git clone https://github.com/HalemoGPA/BrainMRI-Tumor-Classifier-Pytorch.git
cd BrainMRI-Tumor-Classifier-Pytorch
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the Streamlit app:
streamlit run app.py

Results

The model achieves an accuracy of 99.3% on the test set. Training and validation loss and accuracy plots are provided to visualize the model's performance. Confusion matrices illustrate the classification performance on the test set.

Acknowledgments

  • The dataset is provided by MASOUD NICKPARVAR on Kaggle.
  • This project uses PyTorch for building and training the model.

Kaggle Notebook

The model training and evaluation process is detailed in this Kaggle Notebook.

About

A deep learning project using PyTorch to classify brain tumors from MRI images into categories like No Tumor, Pituitary, Glioma, and Meningioma.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published