Skip to content

A Flask web application for predicting brain tumours from MRI scans using a CNN model trained with the Xception architecture

Notifications You must be signed in to change notification settings

ShamikRana/Brain-Tumor-Prediction-Flask-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brain-Tumor-Prediction-Flask-App

A Flask web application focused on detecting various types of brain tumors using Head MRI Scan images. The underlying model was built with a Convolutional Neural Network using the Xception architecture.

Introduction

This project aims to provide a interface for predicting brain tumors based on MRI scan images. The deep learning model, trained on a Kaggle dataset, demonstrates an accuracy of 88.69% on the test data.

Methods Used

  • Data Visualization
  • Data Preprocessing
  • Deep Learning (CNN)
  • Model Deployent using Flask

Tools and Technologies Used

  • Python
  • Numpy, Pandas, Matplotlib, OpenCV
  • Scikit Learn, Tensorflow, Keras
  • Flask, HTML

Model Training Description

  • Data fetched from Kaggle Dataset

  • Images converted into arrays using OpenCV and numpy

  • Dataset divided into 90:10 train-test ratio

  • Normalized data and applied data augmentation

  • Imported Xception model architecture and freeze its layers

  • Utilized the Xception model architecture, fine-tuning with additional dense layers

  • Model saved in H5 format for use in the Flask app

    Dataset Sample Images

Convolutional Neural Network Characteristics

  • Image Input Shape: (150,150,3)
  • Xception architecture layers
  • Dense layers: 512 (ReLU), 256 (ReLU), 4 (Softmax)
  • Optimizer: 'SGD', Loss: 'categorical_crossentropy'
  • Metrics: ['accuracy'], Epochs: 50
  • Last Epoch Validation Accuracy: 88.69%

Accuracy and Loss Graph

Findings

  • The model achieved an accuracy of 88.69% on the test data
  • Confusion matrix provides insights into classification performance Confusion Matrix

Web Application Creation Description

  • Created a Python file "prediction.py" for the prediction function
  • Imported the prediction function into the Flask file "app.py"
  • HTML pages in ./templates: "home.html" and "predict.html"
  • Uploaded files will be saved in ./static/images for prediction
  • Predicted class and confidence will be displayed on the predict.html page

home.html

Home Page

predict.html

Prediction Page

How to Use

  • Fork this repository to have your own copy.
  • Clone your copy on your local system.
  • Install necessary packages into your virtual environment using the command "pip install -r requirements.txt."
  • Run "app.py" file

About

A Flask web application for predicting brain tumours from MRI scans using a CNN model trained with the Xception architecture

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages