Skip to content

erivaninan/Brain-Tumor-Classification

Repository files navigation

Brain Tumor Classification

Overview 🌟

This project was carried out as part of a statistical learning course. It is a first project in image processing.

The goal of this project is to detect and classify brain tumors using MRI images. It supports four classes:

  • Glioma Tumor
  • Meningioma Tumor
  • Pituitary Tumor
  • No Tumor

The project includes features for:

  • Data exploration
  • Model evaluation metrics
  • Explainability analyses
  • A Streamlit application to test the model

Dataset 📊

The dataset used for this project is available on Kaggle: Brain Tumor Classification (MRI).

Data Summary

  • MRIs: Classified into the four categories listed above.
  • Folder structure: Separate folders for training, validation, and testing.
  • Preprocessing: Images are resized, normalized, and converted to grayscale for model training.

Features 🛠️

1. Data Exploration 🔍

An interactive HTML report provides a complete overview of the dataset.

2. Model Metrics 📈

A detailed HTML report with evaluation metrics such as accuracy, recall, and F1-score.

3. Explainability 🧠

Visual analyses of the model’s decisions using Xplique.

4. Streamlit Application 🌐

An intuitive interface that allows users to upload MRI images and obtain real-time classification results.

Note: The application requires the pre-trained model, which is not included in this GitHub repository. You must place the model file in the appropriate folder before running the application.


Installation and Execution ⚙️

Prerequisites

  • Python: Version 3.11 or higher
  • System requirements: A system capable of running virtual environments

Instructions

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-folder>
  2. Run the installation script (Linux/Mac):

    ./lancez_moi.sh

    This script will perform the following actions:

  • Create a virtual environment.
  • Activate the virtual environment.
  • Open the data exploration report in your default browser.
  • Display the model metrics report.
  • Access the explainability analyses.
  • Launch the Streamlit application.
  1. Run the installation script (Windows):

    lancez_moi_windows.sh

    This script is designed for Windows users.

  2. Run the Streamlit application manually:

    cd src/models
    streamlit run CNN_app.py

Folder Structure 📂

project-root/
|
|-- data/                 # Folder containing the dataset (train, validation, test)
|-- Data_visualisation/   # Scripts and files for data visualization
|-- results/              # Reports and results (e.g., metrics.html, explainability analyses)
|-- src/                  # Project source code
|   |-- models/           # Scripts for models, training, and detection
|   |   |-- CNN_app.py    # Streamlit application for classification
|   |   |-- CNN_train.py  # Script to train the CNN model
|   |   |-- preprocessing/ # Image preprocessing modules
|-- venv/                 # Virtual environment files
|-- .gitignore            # Git ignore rules
|-- config.yml            # Project configuration file
|-- lancez_moi.sh         # Installation script for Linux/Mac
|-- lancez_moi_windows.sh # Installation script for Windows
|-- README.md             # Project documentation
|-- requirements.txt      # Python dependencies

README translated from the french version written by Lilya-Nada KHELID @Lilyakhelid.

About

This project aims to develop a custom Convolutional Neural Network (CNN) and perform a benchmark with the pre-trained InceptionV3 model for the automated classification of brain tumors from MRI images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors