/bti

BTI is a high-accuracy (99.3%) brain tumor detection, classification, and diagnosis system using state-of-the-art deep learning methods. This project leverages powerful neural networks to analyze MRI scans and predict the presence and type of brain tumors, assisting in timely

Primary LanguageJupyter NotebookOtherNOASSERTION

BTI: Brain Tumor Detection, Classification, and Diagnosis System

Table of Contents

Overview

BTI is a high-accuracy (99.3%) brain tumor detection, classification, and diagnosis system using state-of-the-art deep learning methods. This project leverages powerful neural networks to analyze MRI scans and predict the presence and type of brain tumors, assisting in timely diagnosis and treatment planning.

The dataset used contains 3064 T1-weighted contrast-enhanced images from 233 patients with three kinds of brain tumors:

  • Meningioma: 708 slices
  • Glioma: 1426 slices
  • Pituitary Tumor: 930 slices

Features

  • High Accuracy: Achieves 99.3% accuracy in brain tumor detection and classification.
  • Deep Learning: Utilizes advanced deep learning techniques for image analysis.
  • Comprehensive Diagnosis: Provides detailed classification of tumor types for better diagnosis.

Installation

  1. Clone the repository:
    git clone https://github.com/garbhitsh/bti.git
  2. Navigate to the project directory:
    cd bti
  3. Install dependencies:
    pip install -r requirements.txt

Usage

Predict using the trained model: bash python predict.py --image_path [path_to_image]

Modules

  • brain_tumor_dataset_preparation.ipynb - An IPython notebook that contains preparation and preprocessing of the dataset for training, validation, and testing.
  • torch_brain_tumor_classifier.ipynb - An IPython notebook that contains all the steps, processes, and results of training, validating, and testing our brain tumor classifier.
  • test.py - A Python script that accepts a path to an image as input, which then classifies the image into one of the three classes.
  • deploy.py - A Python script integrated with a Flask server that starts the web interface on a local server where users can upload MRI images of the brain and get classification results.

Note: We have included a few images for testing under the test_images directory.

Running the Classifier

  1. Download the classifier model .pt file from this drive link and place it in a folder named models in the same directory where the files of this repository are present.

  2. Before running the programs, kindly install the requirements as given in the Installation section of this README.

  3. Use the test.py script to classify an image via the terminal:

    python test.py
  4. Use deploy.py to access the classifier as an interactive web interface:

    python deploy.py

Technologies

  • Numpy - For linear algebra operations
  • Torch - PyTorch Deep Learning Framework
  • OS - To use Operating System methods
  • Random - To set random seed for reproducibility
  • Pandas - For DataFrame creation and CSV handling
  • Time - For date-time operations
  • Seaborn - For sophisticated visualizations
  • Pickle - For saving and loading binary files of training data
  • Scikit-Learn - For evaluating the classifier and cross-validation split
  • Matplotlib - For visualizing images, losses, and accuracy
  • Google Colab Drive - For storage and loading operations on Google Colab

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for review.

  1. Fork the project.
  2. Create your feature branch:
    git checkout -b feature/YourFeatureName
  3. Commit your changes:
    git commit -m 'Add some feature'
  4. Push to the branch:
    git push origin feature/YourFeatureName
  5. Open a pull request.

License

This project is licensed under the MIT License