Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain Tumor Classifier

This project utilizes deep learning to classify brain tumors from MRI scans. It provides a comprehensive solution including a trained model (not included due to size), a Streamlit application for easy inference, and a detailed Jupyter notebook for model training and evaluation.

Table of Contents


Files

  • app.py: The Streamlit application interface. Use this to upload MRI images and get real-time predictions of tumor types.
  • Brain_Tumor_Classification.ipynb: A Jupyter notebook containing the full workflow for data loading, preprocessing, transfer learning (using VGG16), model training, evaluation, and saving the final model.
  • requirements.txt: A list of all Python dependencies required to run the project (TensorFlow, Streamlit, Pillow, NumPy, Plotly, etc.).
  • .gitignore: Configures Git to ignore large files (like the trained model) and temporary files, preventing them from being committed to the repository.

Setup

Follow these steps to set up the project on your local machine.

1. Clone the repository

First, clone the project repository from GitHub:

git clone https://github.com/pranjalparmar/brain_tumor_classifier.git
cd brain_tumor_classifier

2. (Optional) Create and activate a virtual environment

It's recommended to use a virtual environment to manage dependencies:

python -m venv venv
source venv/bin/activate  # On Windows, use: venv\Scripts\activate

3. Install dependencies

Install all required Python packages using pip:

pip install -r requirements.txt

Usage

Run Streamlit App

To start the Streamlit web application:

streamlit run app.py

Once the app is running, open your web browser and navigate to http://localhost:8501. You can then upload MRI scans (in .jpg, .jpeg, or .png format). The app will display the predicted tumor type along with confidence scores.

Important Note: The trained model file (model.keras) is not included in this repository due to its large size. You will need to place your own trained model.keras file in the root project directory for the Streamlit app to function correctly.

Train or Explore the Model

To understand the model's architecture, train a new model, or evaluate its performance:

Open the Brain_Tumor_Classification.ipynb notebook in your preferred Jupyter environment (Jupyter Notebook or JupyterLab). Within the notebook, you can:

  • Load and preprocess the MRI dataset.
  • Train the deep learning model using transfer learning with VGG16.
  • Evaluate the model's accuracy and other performance metrics.
  • Save your newly trained model as model.keras.

Screenshots

Below are some screenshots illustrating the application's interface and functionality.

Example: Streamlit App Interface showing an MRI image upload and prediction.

App Screenshot App Screenshot App Screenshot App Screenshot


Notes & Troubleshooting

  • The model.keras file is intentionally not included in this repository as it exceeds GitHub's file size limitations (100MB).
  • If you don't have the model.keras file, you will need to retrain the model using the provided Jupyter notebook. Alternatively, you could host the trained weights externally and provide a download link for users.
  • Ensure that you only upload MRI image files (.jpg, .jpeg, .png) to the Streamlit application to avoid errors.

License

This project is provided for educational and research purposes only. It is not intended for clinical use or diagnostic purposes.


Contact

This project was created by Pranjal Parmar. For any questions, issues, or collaboration opportunities, please open an issue on the GitHub repository.

About

Brain Tumor Classifier is my hands-on image classification project, applying what I learned in computer vision to detect brain tumors from MRI scans.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages